namespace Acme.ELeMe.SDK.Request;

public class BaseRequest
{
    /// <summary>
    /// </summary>
    public string? cmd { get; set; }

    /// <summary>
    /// </summary>
    public string? timestamp { get; set; }

    /// <summary>
    /// </summary>
    public string? version { get; set; }

    /// <summary>
    /// </summary>
    public string? ticket { get; set; }

    /// <summary>
    /// </summary>
    public string? source { get; set; }

    /// <summary>
    /// </summary>
    public string? sign { get; set; }

    /// <summary>
    /// </summary>
    public string? body { get; set; }

    /// <summary>
    /// </summary>
    public string? encrypt { get; set; }

    public IEnumerable<KeyValuePair<string, string>> ToNameValueCollection()
    {
        return new List<KeyValuePair<string, string>>
        {
            new(nameof(cmd).ToLower(), cmd),
            new(nameof(timestamp).ToLower(), Convert.ToString(timestamp)),
            new(nameof(version).ToLower(), version),
            new(nameof(ticket).ToLower(), ticket),
            new(nameof(source).ToLower(), source),
            new(nameof(sign).ToLower(), sign),
            new(nameof(body).ToLower(), body),
            new(nameof(encrypt).ToLower(), encrypt)
        };
    }
}